﻿@using System.Text
@using Heima8.OA.Model
@{
    Layout = null;
}


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>

    <link href="~/Content/ligerui%20(1)/Source/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <script src="~/Content/ligerui%20(1)/Source/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="~/Content/ligerui%20(1)/Source/lib/ligerUI/js/core/base.js" type="text/javascript"></script>
    <script src="~/Content/ligerui%20(1)/Source/lib/ligerUI/js/ligerui.all.js"></script>
    <style type="text/css">
        .l-case-title {
            font-weight: bold;
            margin-top: 20px;
            margin-bottom: 20px;
        }

        body, html {
            width: 100%;
            height: 100%;
        }

        * {
            margin: 0;
            padding: 0;
        }

        #winlinks {
            position: absolute;
            left: 20px;
            top: 20px;
            width: 100%;
        }

        #winlinks ul {
            position: relative;
        }

        #winlinks li {
            width: 70px;
            cursor: pointer;
            height: 80px;
            position: absolute;
            z-index: 101;
            list-style: none;
            text-align: center;
        }

        #winlinks li img {
            width: 36px;
            height: 36px;
        }

        #winlinks li span {
            background: none repeat scroll 0 0 rgba(0, 0, 0, 0.3);
            border-radius: 10px 10px 10px 10px;
            display: block;
            font-size: 12px;
            margin-top: 1px;
            color: White;
            line-height: 18px;
            text-align: center;
        }

        #winlinks li.l-over div.bg {
            display: block;
        }

        #winlinks li div.bg {
            display: none;
            position: absolute;
            top: -2px;
            left: -2px;
            z-index: 0;
            width: 75px;
            height: 64px;
            -webkit-border-radius: 5px;
            -moz-border-radius: 5px;
            border-radius: 5px;
            background: #000;
            opacity: 0.1;
            filter: alpha(opacity=10);
        }

        .l-taskbar-task-icon {
            top: 3px;
            left: 6px;
            background-image: none;
        }

        .l-taskbar-task-content {
            margin-left: 30px;
        }

        .l-taskbar-task-icon img {
            width: 22px;
            height: 22px;
        }
    </style>
    
    <script type="text/javascript">
        $(function() {
            $("#layout1").ligerLayout();
        });
    </script>
</head>
    <body style="overflow: hidden; background: url(/Content/Images/7_7.jpg) no-repeat  center center;">
        
        <!----------------------网页的头部  开始------------------------->
        <div  style="background: url(/Content/Images/bg3.png) repeat-x;height: 67px;" >
            <img src="~/Content/Images/logo.gif" style="float: left;" />
            <h1 style="float: left;margin-top: 35px;">黑马8期  OA办公系统</h1>
            <img src="~/Content/Images/big.png" style="float: right;" />
        </div>
        <!----------------------网页的头部  结束------------------------->
        
        <!----------------------网页的工作区域  开始------------------------->
        <div id="layout1">
            <div position="center" style="overflow: hidden; background: url(/Content/Images/7_7.jpg) no-repeat  center center;" >
                <div id="winlinks">
                    <ul>
                    </ul>
                </div>
            </div>
        </div>
        <!----------------------网页的工作区域  结束------------------------->


    </body>
<script type="text/javascript">
    var LINKWIDTH = 90, LINKHEIGHT = 90, TASKBARHEIGHT = 43;
    var winlinksul = $("#winlinks ul");

    //点击图标的时候打开对话框
    function f_open(url, title, icon) {
        var win = $.ligerDialog.open(
            {
                height: 500, url: url, width: 750, showMax: true, showToggle: true, showMin: true, isResize: true, modal: false, title: title, slide: false, buttons: [
                    {
                        text: '确定', onclick: function (item, Dialog, index) {
                            win.hide();
                        }
                    }
                ]
            });
        var task = jQuery.ligerui.win.tasks[win.id];
        if (task) {
            $(".l-taskbar-task-icon:first", task).html('<img src="' + icon + '" />');
        }
        return win;
    }
    @{
        List<ActionInfo> menus = ViewBag.AllMenu;
        StringBuilder sb =new StringBuilder();
         foreach (var actionInfo in menus)
         {
             sb.Append("{");
             sb.AppendFormat(" icon: '{0}', title: '{1}', url: '{2}' ", actionInfo.MenuIcon, actionInfo.ActionName, actionInfo.Url);
             sb.Append("},");
         }
        string str = sb.ToString().TrimEnd(',');
         
    }

    //窗口里面所有的图标数据
    var links = [
        @Html.Raw(str)
    ];

    //窗口发生变化的时候图标自适应
    function onResize() {
        var linksHeight = $(window).height() - TASKBARHEIGHT;
        var winlinks = $("#winlinks");
        winlinks.height(linksHeight);
        var colMaxNumber = parseInt(linksHeight / LINKHEIGHT);//一列最多显示几个快捷方式
        for (var i = 0, l = links.length; i < l; i++) {
            var link = links[i];
            var jlink = $("li[linkindex=" + i + "]", winlinks);
            var top = (i % colMaxNumber) * LINKHEIGHT, left = parseInt(i / colMaxNumber) * LINKWIDTH;
            if (isNaN(top) || isNaN(left)) continue;
            jlink.css({ top: top, left: left });
        }

    }

    //图标的初始化工作
    function linksInit() {
        
        for (var i = 0, l = links.length; i < l; i++) {
            var link = links[i];
            var jlink;
            var jlink = $("<li></li>");
            jlink.attr("linkindex", i);
            jlink.append("<img src='" + link.icon + "' />");
            jlink.append("<span>" + link.title + "</span>");
            jlink.append("<div class='bg'></div>");
            jlink.hover(function () {
                $(this).addClass("l-over");
            }, function () {
                $(this).removeClass("l-over");
            }).click(function () {
                var linkindex = $(this).attr("linkindex");
                var link = links[linkindex];
                f_open(link.url, link.title, link.icon);
            });
            jlink.appendTo(winlinksul);
        }

    }

    $(window).resize(onResize);
    $.ligerui.win.removeTaskbar = function () { }; //不允许移除
    $.ligerui.win.createTaskbar(); //页面加载时创建任务栏

    linksInit();
    onResize();
   

</script>
</html>
